<!DOCTYPE html>

<!-- Session 的工作机制是：为每个访客创建一个唯一的 id (UID)，
并基于这个 UID 来存储变量。UID 存储在 cookie 中，或者通过 URL 进行传导 -->

<?php 
session_start();
if(isset($_SESSION["view"])) {
    $_SESSION["view"] = $_SESSION["view"] + 1; 
}else {
    $_SESSION["view"] = 1;
}
echo "浏览量: ". $_SESSION['view'];
?>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
</head>

<body>
	<?php
    // session_destroy();
    if(isset($_SESSION['views']))
{
    unset($_SESSION['views']);
}
?>

</body>

</html>